package com.ruoyi.marry.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.marry.domain.TUserGiftRecord;
import com.ruoyi.marry.mapper.TUserGiftRecordMapper;
import com.ruoyi.marry.service.ITUserGiftRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 礼物记录Service业务层处理
 *
 * @author user_marry
 * @date 2020-11-25
 */
@Service
public class TUserGiftRecordServiceImpl implements ITUserGiftRecordService {
    @Autowired
    private TUserGiftRecordMapper tUserGiftRecordMapper;

    /**
     * 查询礼物记录
     *
     * @param id 礼物记录ID
     * @return 礼物记录
     */
    @Override
    public TUserGiftRecord selectTUserGiftRecordById(Long id) {
        return tUserGiftRecordMapper.selectTUserGiftRecordById(id);
    }

    /**
     * 查询礼物记录列表
     *
     * @param tUserGiftRecord 礼物记录
     * @return 礼物记录
     */
    @Override
    public List<TUserGiftRecord> selectTUserGiftRecordList(TUserGiftRecord tUserGiftRecord) {
        return tUserGiftRecordMapper.selectTUserGiftRecordList(tUserGiftRecord);
    }

    /**
     * 礼物排行榜
     */
    public List<TUserGiftRecord> getLeaderboardOfGift(Long loversId) {
        return tUserGiftRecordMapper.getLeaderboardOfGift(loversId);
    }

    /**
     * 个人送礼物记录
     */
    public List<TUserGiftRecord> geGiftRecord(Long loversId, String openId) {
        return tUserGiftRecordMapper.geGiftRecord(loversId, openId);
    }

    /**
     * 弹幕
     */
    public List<TUserGiftRecord> getBarrage(Long loversId) {
        return tUserGiftRecordMapper.getBarrage(loversId);
    }

    /**
     * 新增礼物记录
     *
     * @param tUserGiftRecord 礼物记录
     * @return 结果
     */
    @Override
    public int insertTUserGiftRecord(TUserGiftRecord tUserGiftRecord) {
        tUserGiftRecord.setCreateTime(DateUtils.getNowDate());
        return tUserGiftRecordMapper.insertTUserGiftRecord(tUserGiftRecord);
    }

    /**
     * 修改礼物记录
     *
     * @param tUserGiftRecord 礼物记录
     * @return 结果
     */
    @Override
    public int updateTUserGiftRecord(TUserGiftRecord tUserGiftRecord) {
        tUserGiftRecord.setUpdateTime(DateUtils.getNowDate());
        return tUserGiftRecordMapper.updateTUserGiftRecord(tUserGiftRecord);
    }

    /**
     * 删除礼物记录对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteTUserGiftRecordByIds(Long[] ids) {
        return tUserGiftRecordMapper.deleteTUserGiftRecordByIds(ids);
    }

    /**
     * 删除礼物记录信息
     *
     * @param id 礼物记录ID
     * @return 结果
     */
    @Override
    public int deleteTUserGiftRecordById(Long id) {
        return tUserGiftRecordMapper.deleteTUserGiftRecordById(id);
    }
}
